package com.cw.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cw.common.api.ResultObject;
import com.cw.dto.*;
import com.cw.entity.CwglBedtypechange;
import com.cw.entity.ThisIiPrepayin;
import com.cw.request.BedChangeTypeRequest;
import com.cw.request.DataSourceRequest;
import com.cw.request.EemptyPatientRequest;
import com.cw.response.DataSourceResponse;
import com.cw.vo.LeaveAdviceVO;
import com.cw.vo.MedicalGroupVO;
import com.cw.vo.PreoperationListVO;
import com.cw.vo.ReadmissionDaysVO;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 住院预约表 服务类
 * </p>
 *
 * @author smq
 * @since 2021-05-06
 */
public interface IThisIiPrepayinService extends IService<ThisIiPrepayin> {

    /**
     * 住院登记记录
     * @param condition 查询条件
     * @return com.github.pagehelper.PageInfo<com.cw.entity.ThisIiPrepayin>
     * @author ly
     * @date 2021/5/6 9:58
     */
    Map<String, Object> getThisIiPrepayinPagination(InpatientRegistrationCondition condition);


    /**
     * 获取没有床位的患者信息
     *
     * @param eemptyPatientRequest
     * @return
     */

    PageInfo<ThisIiPrepayin> getEemptyPatientListNew(EemptyPatientRequest eemptyPatientRequest);

    PageInfo<ThisIiPrepayin> getEemptyPatientListAll(EemptyPatientRequest eemptyPatientRequest);


//    /**
//     * 获取患者详情
//     *
//     * @param id
//     * @return
//     */
//    ThisIiPrepayin getThisIiPrepayin(String id);

    /**
     * 手工录入
     * @param prepayinDTO 手工录入信息
     * @return boolean
     * @author ly
     * @date 2021/5/13 16:04
     */
    ResultObject insertIiPrepayin(PrepayinDTO prepayinDTO) throws Exception;

    /**
     * 编辑-手工录入
     * @param prepayinDTO 编辑对象
     * @author ly
     * @date 2021/5/27 11:11
     * @return com.cw.common.api.ResultObject
     */
    ResultObject editIiPrepayin(PrepayinDTO prepayinDTO);

    /**
     * 根据医生的编码获取手工录入的信息
     * @param clinicCode 什么什么的编码
     * @author ly
     * @date 2021/5/18 15:36
     * @return com.cw.common.api.ResultObject
     */
    ResultObject getInsertIiPrepayinInsertSource(String clinicCode);


    /**
     * 获取报表数据
     *
     * @param dataSourceRequest
     * @return
     */
    PageInfo<DataSourceResponse> getDataSource(DataSourceRequest dataSourceRequest);

//    PageInfo<DataSourceResponse> getEmptyBedReportNew(DataSourceRequest dataSourceRequest);
//
//    List<DataSourceResponse> getEmptyBedReportSource(DataSourceRequest dataSourceRequest);


    /**
     * 导出报表数据
     *
     * @param response
     * @param dataSourceRequest
     * @throws IOException
     */
    void downDataSourceFormExcel(HttpServletResponse response, DataSourceRequest dataSourceRequest) throws IOException;

    /**
     * 住院登记记录
     * @param condition 查询条件
     * @author ly
     * @date 2021/5/20 9:47
     * @return java.util.Map<java.lang.String, java.lang.Object>
     */
    Map<String, Object> getTheInpatientOfficeHasBeenProcessed(InpatientRegistrationCondition condition);

    /**
     * 更改状态为作废状态
     * @param preId 预约记录号
     * @author ly
     * @date 2021/5/31 10:51
     * @return boolean
     */
    boolean updateState(Integer preId);

    /**
     * 出院列表
     * <p>2021-07-19
     * 不在使用这个接口,因询问了信息科的人有更准确的查询方法<p/>
     * @param condition 查询条件
     * @return java.lang.Map<java.lang.String, java.lang.Object>
     * @author ly
     * @date 2021/07/13 11:04
     */
    @Deprecated
    Map<String, Object> dischargeList(InpatientRegistrationCondition condition);

    /**
     * 历史记录列表
     * @param condition 查询条件
     * @return java.lang.Map<java.lang.String, java.lang.Object>
     * @author ly
     * @date 2021/07/19 14:27
     */
    Map<String, Object> historyRecord(InpatientRegistrationCondition condition);

    /**
     * 将电子住院证设置为取消状态
     * @author ly
     * @date 2021-09-07 10:20
     * @param preId 主键
     * @return java.lang.boolean
     */
    boolean cancelIiprepayIn(String preId, String state);

    /**
     * 修改床位属性
     * @author cww
     * @date 2021-09-29 10:20
     * @param listInfo
     * @return java.lang.boolean
     */
    boolean changeBedType(List<CwglBedtypechange> listInfo);

    /**
     * 修改床位属性(病区)
     * @author cww
     * @date 2021-09-29 10:20
     * @param nurseCode 病区
     * @return java.lang.boolean
     */
    boolean changeBedTypeByNurseCode(String nurseCode);


    /**
     * 床位类型转换查询
     * @author xnd
     * @date 2021-10-13 xxxx
     * @param
     * @return java.lang.ResultObject
     */
    PageInfo<CwglBedtypechange> selectCwInformation(BedChangeTypeRequest request);


    /**
     * 释放历史床位
     * @param releaseJGBedHistoryDTO 编辑对象
     * @author cww
     * @date 2022/5/25 11:11
     * @return com.cw.common.api.ResultObject
     */
    ResultObject releaseJGBedHistory(ReleaseJGBedHistoryDTO releaseJGBedHistoryDTO);

    ResultObject getThisIiPrepayinByPreid(BigDecimal preid);

    /**
     * 出院医嘱查询
     *
     * @param dto
     * @return
     */
    List<LeaveAdviceVO> leaveAdvicePage(LeaveAdviceDTO dto);

    /**
     * 预手术编码查询
     *
     * @param dto
     * @return
     */
    List<PreoperationListVO> preoperation(PreoperationDTO dto);

    /**
     * 专业组codename|
     * @return List<MedicalGroupVO>
     */
    List<MedicalGroupVO> getmedicalGroup(String deptCode);

    /**
     * 医疗组组长codename
     *
     * @param medicalGroupCode
     * @param deptCode
     * @return
     */
    List<MedicalGroupVO>  getmedicalGroupLeader(String medicalGroupCode,String deptCode);

    /**
     * 获取上一次出院时间与这次开立住院证的时间差
     *
     * @param idenNo
     * @param predate
     * @return
     */
    ResultObject getReadmissionDays(String idenNo, Date predate);
}
